package cn.iocoder.yudao.module.member.dal.mysql.useranswer;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.member.dal.dataobject.useranswer.UserAnswerDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.member.controller.admin.useranswer.vo.*;

/**
 * 问答明细 Mapper
 *
 * @author 芋道源码
 */
@Mapper
public interface UserAnswerMapper extends BaseMapperX<UserAnswerDO> {

    default PageResult<UserAnswerDO> selectPage(UserAnswerPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UserAnswerDO>()
                .betweenIfPresent(UserAnswerDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(UserAnswerDO::getUserId, reqVO.getUserId())
                .eqIfPresent(UserAnswerDO::getExpertId, reqVO.getExpertId())
                .betweenIfPresent(UserAnswerDO::getBeginTime, reqVO.getBeginTime())
                .betweenIfPresent(UserAnswerDO::getEndTime, reqVO.getEndTime())
                .betweenIfPresent(UserAnswerDO::getResponseTime, reqVO.getResponseTime())
                .eqIfPresent(UserAnswerDO::getPoints, reqVO.getPoints())
                .eqIfPresent(UserAnswerDO::getPic, reqVO.getPic())
                .eqIfPresent(UserAnswerDO::getAnswer, reqVO.getAnswer())
                .eqIfPresent(UserAnswerDO::getAccept, reqVO.getAccept())
                .orderByDesc(UserAnswerDO::getId));
    }

}